import 'package:dio/dio.dart';  //post、getAPI
import '../config/server_url.dart';  //引入配置文件

//通用方法
Future request(url,{formData})async{
  try{
    print('开始获取数据...............');
    Response response;
    Dio dio = new Dio();
    if(formData==null){
      response = await dio.post(servicePath[url]);
    }else{
      response = await dio.post(servicePath[url],queryParameters:formData);
    }
    // print(response);
    if(response.statusCode==200){
      // print(response.data);
      return response.data;
    }else{
      throw Exception('1后端接口出现异常，请检测代码和服务器情况.........');
    }
  }catch(e){
    return print('ERROR:======>${e}');
  }

}